<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>OAuth</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
    <link rel="stylesheet" href="css/style.css">
</head>
<body ontouchstart="">
<button class="btn btn_primary" id="oauth">OAuth</button>

<script src="js/jquery.min.js" type="application/javascript"></script>
<script type="application/javascript">
    var url = window.location.href;
    var params = url.split("?")[1];
    if (params) {
        var _params = params.split("&");
        for (var i in _params) {
            var p = _params[i];
            if (p.indexOf("openId") != -1) {
                alert(p);
            }
        }
    }

    (function () {
        $("#oauth").bind('click', function () {
            window.location.href = "http://wx.izufang.me/rest/weixin/init?url=" + encodeURIComponent("http://web.izufang.me/wechatweb") + "&scope=snsapi_userinfo";
        });
    })();
</script>
</body>
</html>